<extend name="Base/layout" />
<block name="content">
<div class="layui-btn-group operateTable">
    <button class="layui-btn layui-btn-normal" data-type="add_article"><i class="layui-icon" style="">&#xe654;</i>添加文章</button>
    <button class="layui-btn" data-type="auditing_article"><i class="layui-icon" style="">&#xe605;</i>批量审核</button>
    <button class="layui-btn layui-btn-danger" data-type="delete_article"><i class="layui-icon" style="">&#xe640;</i>批量删除</button>
</div>
<table class="layui-table layui-form" id="article" lay-filter="article" style="display: none;">
</table>
<script type="text/html" id="switchTpl">
    <input type="checkbox" name="auditing" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="auditing" {{ d.auditing == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit"><i class="layui-icon" style="">&#xe642;</i></a>
    <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del"><i class="layui-icon" style="">&#xe640;</i></a>
</script>
<script type="text/template" id="edit_article_container" data-title="文章内容">
    <div class="template-box" style="padding-left: 0;">
        <form class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">标题：</label>
                <div class="layui-input-block">
                    <input type="text" name="title" lay-verify="title" placeholder="请输入标题" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">分类：</label>
                    <div class="layui-input-inline">
                        <select name="catid" lay-filter="catid" lay-verify="catid">
                            <option value=""></option>
                            <foreach name="categorys" item="category">
                                <option value="{$category.catid}">{$category.name}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">标签：</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="tag" title="置顶" value="置顶">
                        <input type="checkbox" name="tag" title="精贴" value="精贴">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">是否审核：</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="auditing" lay-skin="switch" lay-text="是|否">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">内容：</label>
                <div class="layui-input-block">
                    <textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="editors" placeholder="请输入文章内容">
                    </textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="button" class="layui-btn" lay-submit="" lay-filter="eidt_article">确定</button>
                    <button type="button" class="layui-btn layui-btn-primary btn-cancel">取消</button>
                </div>
            </div>
        </form>
    </div>
</script>

<script type="text/template" id="add_article_container" data-title="文章内容">
    <div class="template-box">
        <form class="layui-form layui-form-pane">
            <div class="layui-form-item">
                <label class="layui-form-label">标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title" required  lay-verify="title" placeholder="请输入标题" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">分类</label>
                <div class="layui-input-block">
                    <select name="catid" lay-filter="catid" lay-verify="catid">
                        <option value=""></option>
                        <foreach name="categorys" item="category">
                            <option value="{$category.catid}">{$category.name}</option>
                        </foreach>
                    </select>
                </div>
            </div>
            <div class="layui-form-item" pane>
                <label class="layui-form-label">标签</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="tag" title="置顶" value="置顶">
                    <input type="checkbox" name="tag" title="精贴" value="精贴">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">内容</label>
                <div class="layui-input-block">
                    <textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="editor" placeholder="请输入文章内容">
                    </textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="button" class="layui-btn" lay-submit="" lay-filter="add-article">确定</button>
                    <button type="button" class="layui-btn layui-btn-primary btn-cancel">取消</button>
                </div>
            </div>
        </form>
    </div>
</script>
</block>
<block name="urls">
    article:"{:U('Admin/article/index')}",
    addArticle:"{:U('Admin/article/addArticle')}",
    deleteArticle:"{:U('Admin/article/deleteArticle')}",
    page:"{:U('Admin/article/page')}",
    findOne:"{:U('Admin/article/findOne')}",
    editArticle:"{:U('Admin/article/editArticle')}",
    uploadImg:"{:U('Admin/upload/uploadImg')}"
</block>
<block name="javascript">
    <script type="text/javascript" src="__JS__/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="__JS__/article.js"></script>
    <script type="text/javascript">
    $(function(){
        Article.initialize();
    });
    </script>
</block>